<template>
  <div>
    <div class="topbar bg-black py-2 px-3 d-flex ai-center">
      <img src="../assets/images/logo.png" height="30px" alt />
      <div class="px-2 flex-1">
        <div class="text-white ml-3">王者荣耀</div>
        <div class="text-grey ml-3 fs-xxs">团队成就更多</div>
      </div>
      <button class="btn bg-primary">立即下载</button>
    </div>
    <div class="py-3 bg-primary">
      <div class="nav d-flex jc-around text-white">
        <div class="nav-item " :class="{active: active ==='/' }">
          <router-link class="nav-link" tag="div" to="/">首页 </router-link>
        </div>
        <div class="nav-item" :class="{active: active ==='/strategy'}">
          <router-link class="nav-link" tag="div" to="/strategy">攻略中心</router-link>
        </div>
        <div class="nav-item " :class="{active: active ==='/match'}">
          <router-link class="nav-link" tag="div" to="/match">赛事中心</router-link>
        </div>
      </div>
    </div>
    <router-view></router-view>
  </div>
</template>

<script>
export default {
  name: "",
  data() {
    return {
      active: this.$route.path
    };
  },
  created() {
  },
  methods: {},
  watch:{
  $route(to,from){
    // console.log(to.path);
    this.active = to.path
  }
},
};
</script>

<style lang="scss">
.nav-item{
    border-bottom: 3px solid transparent;
    padding-bottom: 0.2rem;
}
.active{
    border-bottom: 3px solid white;
}
.topbar{
  position: sticky;
  top: 0;
  z-index: 10;
}
</style>